<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta content="Cask Data, Inc." name="author" />
<meta content="Copyright © 2015-2017 Cask Data, Inc." name="copyright" />


    <meta name="git_release" content="6.1.1">
    <meta name="git_hash" content="05fbac36f9f7aadeb44f5728cea35136dbc243e5">
    <meta name="git_timestamp" content="2020-02-09 08:22:47 +0800">
    <title>Artifacts</title>

    <link rel="stylesheet" href="../_static/cdap-bootstrap.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <link rel="stylesheet" href="../_static/bootstrap-3.3.6/css/bootstrap.min.css" type="text/css" />
    <link rel="stylesheet" href="../_static/bootstrap-3.3.6/css/bootstrap-theme.min.css" type="text/css" />
    <link rel="stylesheet" href="../_static/css/bootstrap-sphinx.css" type="text/css" />
    <link rel="stylesheet" href="../_static/css/cdap-dynamicscrollspy-4.css" type="text/css" />
    <link rel="stylesheet" href="../_static/css/jquery.mCustomScrollbar.css" type="text/css" />
    <link rel="stylesheet" href="../_static/css/cdap-jquery.mCustomScrollbar.css" type="text/css" />
    <link rel="stylesheet" href="../_static/css/abixTreeList-2.css" type="text/css" />
    <link rel="stylesheet" href="../_static/cdap-bootstrap.css" type="text/css" />

    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '6.1.1',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  false
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/language_data.js"></script>

    <link rel="shortcut icon" href="../_static/favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="top" title="Cask Data Application Platform 6.1.1 Documentation" href="../index.html" />
    <link rel="up" title="核心概念" href="index.html" />
    <link rel="next" title="Program Lifecycle" href="program-lifecycle.html" />
    <link rel="prev" title="Workflows" href="workflows.html" />
    <!-- block extrahead -->
    <meta charset='utf-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
    <meta name="apple-mobile-web-app-capable" content="yes">
    <!-- block extrahead end -->

</head>
<body role="document">

<!-- block navbar -->
<div id="navbar" class="navbar navbar-inverse navbar-default navbar-fixed-top">
    <div class="container-fluid">
      <div class="row">
        <div class="navbar-header">
          <!-- .btn-navbar is used as the toggle for collapsed navbar content -->
          <a class="navbar-brand" href="../table-of-contents/../../index.html">
            <span><img alt="CDAP logo" src="../_static/cdap_logo.svg"/></span>
          </a>

          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>

          <div class="pull-right">
            <div class="dropdown version-dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown"
                role="button" aria-haspopup="true" aria-expanded="false">
                v 6.1.1 <span class="caret"></span>
              </a>
              <ul class="dropdown-menu">
                <li><a href="//docs.cdap.io/cdap/5.1.2/en/index.html">v 5.1.2</a></li>
                <li><a href="//docs.cdap.io/cdap/4.3.4/en/index.html">v 4.3.4</a></li>
              </ul>
            </div>
          </div>
          <form class="navbar-form navbar-right navbar-search" action="../search.html" method="get">
            <div class="form-group">
              <div class="navbar-search-image material-icons"></div>
              <input type="text" name="q" class="form-control" placeholder="  Search" />
            </div>
            <input type="hidden" name="check_keywords" value="yes" />
            <input type="hidden" name="area" value="default" />
          </form>

          <div class="collapse navbar-collapse nav-collapse navbar-right navbar-navigation">
            <ul class="nav navbar-nav"><li class="docsite-nav-tab-container"><a class="docsite-nav-tab-link " href="../table-of-contents/../../index.html">简介</a></li><li class="docsite-nav-tab-container"><a class="docsite-nav-tab-link current" href="../table-of-contents/../../guides.html">手册</a></li><li class="docsite-nav-tab-container"><a class="docsite-nav-tab-link " href="../table-of-contents/../../reference-manual/index.html">参考</a></li><li class="docsite-nav-tab-container"><a class="docsite-nav-tab-link " href="../table-of-contents/../../faqs/index.html">帮助</a></li>
            </ul>
          </div>

        </div>
      </div>
    </div>
  </div><!-- block navbar end -->
<!-- block main content -->
<div class="main-container container">
  <div class="row"><div class="col-md-2">
      <div id="sidebar" class="bs-sidenav scrollable-y-outside" role="complementary">
<!-- theme_manual: developer-manual -->
<!-- theme_manual_highlight: guides -->
<!-- sidebar_title_link: ../table-of-contents/../../guides.html -->

  <div role="note" aria-label="manuals links"><h3><a href="../table-of-contents/../../guides.html">Guides</a></h3>

    <ul class="this-page-menu">
      <li class="toctree-l1"><a href="../table-of-contents/../../user-guide/index.html" rel="nofollow">用户手册</a>
      </li>
      <li class="toctree-l1"><b><a href="../table-of-contents/../../developer-manual/index.html" rel="nofollow">开发手册</a></b>
      <nav class="pagenav">
      <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../index.html"> 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../getting-started/index.html"> 入门指南</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../getting-started/sandbox/index.html">CDAP Sandbox</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../getting-started/sandbox/zip.html">二进制 Zip 文件</a></li>
<li class="toctree-l3"><a class="reference internal" href="../getting-started/sandbox/zip.html#cdap-sandbox">启动和停止 CDAP Sandbox</a></li>
<li class="toctree-l3"><a class="reference internal" href="../getting-started/sandbox/virtual-machine.html">虚拟机镜像</a></li>
<li class="toctree-l3"><a class="reference internal" href="../getting-started/sandbox/docker.html">Docker 镜像</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../getting-started/quick-start.html">快速入门</a></li>
<li class="toctree-l2"><a class="reference internal" href="../getting-started/dev-env.html">搭建开发环境</a></li>
<li class="toctree-l2"><a class="reference internal" href="../getting-started/start-stop-cdap.html">启动和停止 CDAP</a></li>
<li class="toctree-l2"><a class="reference internal" href="../getting-started/building-apps.html">构建并运行应用</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../overview/index.html"> 概述</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../overview/anatomy.html"> 大数据应用剖析</a></li>
<li class="toctree-l2"><a class="reference internal" href="../overview/modes.html"> 模式和组件</a></li>
<li class="toctree-l2"><a class="reference internal" href="../overview/abstractions.html"> 核心概念</a></li>
<li class="toctree-l2"><a class="reference internal" href="../overview/interfaces.html"> 编程接口</a></li>
</ul>
</li>
<li class="toctree-l1 current"><a class="reference internal" href="index.html"> 抽象概念</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="core.html"> Core Abstractions</a></li>
<li class="toctree-l2"><a class="reference internal" href="applications.html"> Applications</a></li>
<li class="toctree-l2"><a class="reference internal" href="datasets/index.html"> Datasets</a><ul>
<li class="toctree-l3"><a class="reference internal" href="datasets/overview.html"> Overview</a></li>
<li class="toctree-l3"><a class="reference internal" href="datasets/table.html"> Table API</a></li>
<li class="toctree-l3"><a class="reference internal" href="datasets/fileset.html"> FileSets</a></li>
<li class="toctree-l3"><a class="reference internal" href="datasets/partitioned-fileset.html"> Partitioned FileSets</a></li>
<li class="toctree-l3"><a class="reference internal" href="datasets/time-partitioned-fileset.html"> TimePartitioned FileSets</a></li>
<li class="toctree-l3"><a class="reference internal" href="datasets/system-custom.html"> System and Custom Datasets</a></li>
<li class="toctree-l3"><a class="reference internal" href="datasets/permissions.html"> Dataset Permissions</a></li>
<li class="toctree-l3"><a class="reference internal" href="datasets/cube.html"> Cube Dataset</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="mapreduce-programs.html"> MapReduce Programs</a></li>
<li class="toctree-l2"><a class="reference internal" href="plugins.html"> Plugins</a></li>
<li class="toctree-l2"><a class="reference internal" href="schedules.html"> Schedules</a></li>
<li class="toctree-l2"><a class="reference internal" href="secure-keys.html"> Secure Keys</a></li>
<li class="toctree-l2"><a class="reference internal" href="services.html"> Services</a></li>
<li class="toctree-l2"><a class="reference internal" href="spark-programs.html"> Spark Programs</a></li>
<li class="toctree-l2"><a class="reference internal" href="workers.html"> Workers</a></li>
<li class="toctree-l2"><a class="reference internal" href="workflows.html"> Workflows</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#"> Artifacts</a></li>
<li class="toctree-l2"><a class="reference internal" href="program-lifecycle.html"> Program Lifecycle</a></li>
<li class="toctree-l2"><a class="reference internal" href="namespaces.html"> Namespaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="transaction-system.html"> Transaction System</a></li>
<li class="toctree-l2"><a class="reference internal" href="transactional-messaging-system.html"> Transactional Messaging System</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../metadata/index.html"> 元数据</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../metadata/system-metadata.html"> System Metadata</a></li>
<li class="toctree-l2"><a class="reference internal" href="../metadata/discovery-lineage.html"> Discovery and Lineage</a></li>
<li class="toctree-l2"><a class="reference internal" href="../metadata/field-lineage.html"> Field Level Lineage</a></li>
<li class="toctree-l2"><a class="reference internal" href="../metadata/audit-logging.html"> Audit Logging</a></li>
<li class="toctree-l2"><a class="reference internal" href="../metadata/metadata-ui.html"> CDAP Metadata UI</a></li>
<li class="toctree-l2"><a class="reference internal" href="../metadata/programmatic-metadata.html"> Accessing metadata programmatically</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../pipelines/index.html"> 数据流管道</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../pipelines/concepts-design.html"> Concepts and Design</a></li>
<li class="toctree-l2"><a class="reference internal" href="../pipelines/getting-started.html"> Getting Started</a></li>
<li class="toctree-l2"><a class="reference internal" href="../pipelines/studio.html"> CDAP Studio</a></li>
<li class="toctree-l2"><a class="reference internal" href="../pipelines/creating-pipelines.html"> Creating Pipelines</a></li>
<li class="toctree-l2"><a class="reference internal" href="../pipelines/running-pipelines.html"> Running Pipelines</a></li>
<li class="toctree-l2"><a class="reference internal" href="../pipelines/plugin-management.html"> Plugin Management</a></li>
<li class="toctree-l2"><a class="reference internal" href="../pipelines/plugins/index.html"> Plugin Reference</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../pipelines/plugins/actions/index.html"> Action Plugins</a><ul class="simple">
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../pipelines/plugins/sources/index.html"> Source Plugins</a><ul class="simple">
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../pipelines/plugins/transforms/index.html"> Transform Plugins</a><ul class="simple">
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../pipelines/plugins/analytics/index.html"> Analytic Plugins</a><ul class="simple">
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../pipelines/plugins/sinks/index.html"> Sink Plugins</a><ul class="simple">
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../pipelines/plugins/shared-plugins/index.html"> Shared Plugins</a><ul>
<li class="toctree-l4"><a class="reference internal" href="../pipelines/plugins/shared-plugins/core.html">CoreValidator</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../pipelines/plugins/post-run-plugins/index.html"> Post-run Plugins</a><ul class="simple">
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../pipelines/developing-pipelines.html"> Developing Pipelines</a></li>
<li class="toctree-l2"><a class="reference internal" href="../pipelines/developing-plugins/index.html"> Developing Plugins</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../pipelines/developing-plugins/plugin-basics.html">Plugin Basics</a></li>
<li class="toctree-l3"><a class="reference internal" href="../pipelines/developing-plugins/creating-a-plugin.html">Creating a Plugin</a></li>
<li class="toctree-l3"><a class="reference internal" href="../pipelines/developing-plugins/presentation-plugins.html">Plugin Presentation</a></li>
<li class="toctree-l3"><a class="reference internal" href="../pipelines/developing-plugins/testing-plugins.html">Testing Plugins</a></li>
<li class="toctree-l3"><a class="reference internal" href="../pipelines/developing-plugins/packaging-plugins.html">Packaging Plugins</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../pipelines/how-cdap-pipelines-work.html"> How CDAP Pipelines Work</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../cloud-runtimes/index.html"> 云平台运行</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../cloud-runtimes/concepts/index.html"> Concepts</a></li>
<li class="toctree-l2"><a class="reference internal" href="../cloud-runtimes/provisioners/index.html"> Provisioners</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../cloud-runtimes/provisioners/gcp-dataproc.html">Google Dataproc</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cloud-runtimes/provisioners/aws-emr.html">Amazon Elastic MapReduce</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cloud-runtimes/provisioners/remote-hadoop.html">Remote Hadoop</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../cloud-runtimes/profiles/index.html"> Profiles</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../cloud-runtimes/profiles/creating-profiles.html">Creating Profiles</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cloud-runtimes/profiles/assigning-profiles.html">Assigning Profiles</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cloud-runtimes/profiles/admin-controls.html">Admin Controls</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../cloud-runtimes/example/index.html"> Example</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../security/index.html"> 安全</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../security/client-authentication.html">Client Authentication</a></li>
<li class="toctree-l2"><a class="reference internal" href="../security/cdap-authentication-clients-java.html">CDAP Authentication Client for Java</a></li>
<li class="toctree-l2"><a class="reference internal" href="../security/cdap-authentication-clients-python.html">CDAP Authentication Client for Python</a></li>
<li class="toctree-l2"><a class="reference internal" href="../security/custom-authentication.html">Custom Authentication</a></li>
<li class="toctree-l2"><a class="reference internal" href="../security/authorization-extensions.html">Authorization Extensions</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../testing/index.html"> 测试和调试</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../testing/testing.html"> Testing a CDAP Application</a></li>
<li class="toctree-l2"><a class="reference internal" href="../testing/debugging.html"> Debugging</a></li>
<li class="toctree-l2"><a class="reference internal" href="../testing/troubleshooting.html"> Troubleshooting</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../ingesting-tools/index.html"> 数据融合</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../ingesting-tools/cdap-stream-clients-java.html">CDAP Stream Client for Java</a></li>
<li class="toctree-l2"><a class="reference internal" href="../ingesting-tools/cdap-stream-clients-python.html">CDAP Stream Client for Python</a></li>
<li class="toctree-l2"><a class="reference internal" href="../ingesting-tools/cdap-stream-clients-ruby.html">CDAP Stream Client for Ruby</a></li>
<li class="toctree-l2"><a class="reference internal" href="../ingesting-tools/cdap-flume.html">CDAP Flume</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../data-exploration/index.html"> 数据探索</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../data-exploration/filesets.html"> Fileset Exploration</a></li>
<li class="toctree-l2"><a class="reference internal" href="../data-exploration/tables.html"> Table Exploration</a></li>
<li class="toctree-l2"><a class="reference internal" href="../data-exploration/object-mapped-tables.html"> ObjectMappedTable Exploration</a></li>
<li class="toctree-l2"><a class="reference internal" href="../data-exploration/custom-datasets.html"> Custom Dataset Exploration</a></li>
<li class="toctree-l2"><a class="reference internal" href="../data-exploration/hive-execution-engines.html"> Hive Execution Engines</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../advanced/index.html"> 高级主题</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../advanced/application-logback.html"> Application Logback</a></li>
<li class="toctree-l2"><a class="reference internal" href="../advanced/best-practices.html"> Best Practices</a></li>
<li class="toctree-l2"><a class="reference internal" href="../advanced/class-loading.html"> Class Loading</a></li>
<li class="toctree-l2"><a class="reference internal" href="../advanced/configuring-resources.html"> Configuring Program Resources</a></li>
<li class="toctree-l2"><a class="reference internal" href="../advanced/program-retry-policies.html"> Program Retry Policies</a></li>
</ul>
</li>
</ul>
</nav>
      </li>
      <li class="toctree-l1"><a href="../table-of-contents/../../admin-manual/index.html" rel="nofollow">管理手册</a>
      </li>
      <li class="toctree-l1"><a href="../table-of-contents/../../integrations/index.html" rel="nofollow">集成手册</a>
      </li>
      <li class="toctree-l1"><a href="../table-of-contents/../../examples-manual/index.html" rel="nofollow">最佳实践</a>
      </li>
    </ul>
  </div></div>
    </div><div class="col-md-8 content" id="main-content">
    
  <div class="section" id="artifacts">
<span id="id1"></span><h1>Artifacts<a class="headerlink" href="#artifacts" title="Permalink to this headline">🔗</a></h1>
<p>An <em>Artifact</em> is a JAR file that contains Java classes and resources required to create and run an <em>Application</em>.
<em>Artifacts</em> are identified by a <em>name</em>, <em>version</em>, and <em>scope</em>.</p>
<p>The <strong>artifact name</strong> must consist only of alphanumeric, <code class="docutils literal notranslate"><span class="pre">'-'</span></code> (hyphen), and <code class="docutils literal notranslate"><span class="pre">'_'</span></code> (underscore) characters.
For example, <code class="docutils literal notranslate"><span class="pre">'my-application'</span></code> is a valid artifact name, but <code class="docutils literal notranslate"><span class="pre">'my:application'</span></code> is not.</p>
<p>The <strong>artifact version</strong> is of the format <code class="docutils literal notranslate"><span class="pre">'[major].[minor].[fix](-\|.)[suffix]'</span></code>. Minor, fix, and suffix
portions of the version are optional, though it is suggested that you have them conform to
standard versioning schemes. The major, minor, and fix portions of the version must be numeric.
The suffix can be any of the acceptable characters. For example, <code class="docutils literal notranslate"><span class="pre">'3.2.0-SNAPSHOT'</span></code> is a valid artifact version,
with a major version of 3, minor version of 2, fix version of 0, and suffix of <code class="docutils literal notranslate"><span class="pre">SNAPSHOT</span></code>.</p>
<p>The <strong>artifact scope</strong> is either <code class="docutils literal notranslate"><span class="pre">'user'</span></code> or <code class="docutils literal notranslate"><span class="pre">'system'</span></code>. An artifact in the <em>‘user’</em> scope is added by users
through the CLI or RESTful API. A <em>‘user’</em> artifact belongs in a namespace and cannot be accessed in
another namespace. A <em>‘system’</em> artifact is an artifact that is available across all namespaces. It
is added by placing the artifact in a special directory on either the CDAP Master node(s) or the
CDAP Sandbox.</p>
<p>Once added to CDAP, an <em>Artifact</em> cannot be modified unless it is a <strong>snapshot artifact.</strong>
An <em>Artifact</em> is a snapshot artifact if the version suffix begins with <code class="docutils literal notranslate"><span class="pre">SNAPSHOT</span></code>. For example,
<code class="docutils literal notranslate"><span class="pre">'1.2.3.SNAPSHOT-test'</span></code> is a snapshot version because it has a suffix of <code class="docutils literal notranslate"><span class="pre">'SNAPSHOT-test'</span></code>, which
begins with <code class="docutils literal notranslate"><span class="pre">SNAPSHOT</span></code>. <code class="docutils literal notranslate"><span class="pre">'1.2.3'</span></code> is not a snapshot version because there is no suffix. <code class="docutils literal notranslate"><span class="pre">'1.2.3-hadoop2'</span></code>
is also not a snapshot version because the suffix does not begin with <code class="docutils literal notranslate"><span class="pre">SNAPSHOT</span></code>.</p>
<p>Artifacts are managed using the <span class="xref std std-ref">Artifact HTTP RESTful APIs</span>.</p>
<div class="section" id="deploying-an-artifact">
<h2>Deploying an Artifact<a class="headerlink" href="#deploying-an-artifact" title="Permalink to this headline">🔗</a></h2>
<p>An artifact is deployed through the <span class="xref std std-ref">RESTful API</span>.
If it contains an Application class, the artifact
can then be used to create applications. Once an artifact is deployed, it cannot be changed, with
the exception of snapshot versions of artifacts. Snapshot artifacts can be deployed multiple times,
with each deployment overwriting the previous artifact. If a program is using a snapshot artifact,
changes made to the artifact are picked up when the program is started. Once a program has started,
it is unaffected by changes made to the artifact.</p>
</div>
<div class="section" id="plugin-artifacts">
<h2>Plugin Artifacts<a class="headerlink" href="#plugin-artifacts" title="Permalink to this headline">🔗</a></h2>
<p>Sometimes an application class exposes an interface that it expects other artifacts to implement.
For example, CDAP ships with a <code class="docutils literal notranslate"><span class="pre">cdap-data-pipeline</span></code> artifact that can be used to create data pipeline applications.
The artifact exposes a <code class="docutils literal notranslate"><span class="pre">batchsource</span></code> interface that it expects others to implement.
The <code class="docutils literal notranslate"><span class="pre">core-plugins</span></code> artifact contains several plugins that implement that interface. There is one source
for databases, another for HDFS files, etc. To make plugins in one artifact available to
another artifact, the plugin artifact must specify its parent artifacts. All of those parent artifacts
will then be able to use those plugins.</p>
</div>
<div class="section" id="deleting-an-artifact">
<h2>Deleting an Artifact<a class="headerlink" href="#deleting-an-artifact" title="Permalink to this headline">🔗</a></h2>
<p>Though artifacts cannot be modified once deployed, they can be deleted. Artifact deletion is an advanced
feature and is only meant to be used if there was some error deploying the artifact. When an artifact is
deleted, any application that is configured to use the artifact will be unable to start their programs.
If a program is already running, it will be unaffected. If that running program is stopped, it will not
be able to start again until the artifact is replaced, or the application is updated to use another
artifact.</p>
</div>
<div class="section" id="user-and-system-artifacts">
<h2>User and System Artifacts<a class="headerlink" href="#user-and-system-artifacts" title="Permalink to this headline">🔗</a></h2>
<p>Normally, an artifact is added to a specific namespace. Users in one namespace cannot see or use
artifacts in another namespace. These are referred to as <a class="reference internal" href="plugins.html#plugins-deployment-user"><span class="std std-ref">user artifacts</span></a>.</p>
<p>Sometimes there is a need to provide an artifact that can be used across namespaces. One
example of this are the <a class="reference internal" href="../pipelines/plugins/index.html#cdap-pipelines-plugins"><span class="std std-ref">pipeline artifacts</span></a> shipped with
CDAP. In such scenarios, a <a class="reference internal" href="plugins.html#plugins-deployment-system"><span class="std std-ref">system artifact</span></a> can be used.</p>
<p>System artifacts cannot be added through the RESTful API, but must be added by placing the
artifact in a special directory. For Distributed CDAP, this directory is defined by the
<code class="docutils literal notranslate"><span class="pre">app.artifact.dir</span></code> setting in <span class="xref std std-ref">cdap-site.xml</span>. Multiple directories
can be defined by separating them with a semicolon. It defaults to
<code class="docutils literal notranslate"><span class="pre">/opt/cdap/master/artifacts</span></code>. For the CDAP Sandbox, the directory is set to the
<code class="docutils literal notranslate"><span class="pre">artifacts</span></code> directory.</p>
<p>Any artifact in the directory will be added to CDAP when it starts up. In addition, a
<span class="xref std std-ref">RESTful API</span>
call can be made to scan the directory for any new artifacts that may have been added since CDAP
started.</p>
<p>If a system artifact contains plugins that extend another system artifact, a matching
JSON config file must be provided to specify which artifacts it extends. In addition, if a system
artifact is a third-party JAR, the plugins in the artifact can be explicitly listed in that same config
file.</p>
<p>For example, suppose you want to add <code class="docutils literal notranslate"><span class="pre">mysql-connector-java-5.1.3.jar</span></code> as a system artifact. The
artifact is the MySQL JDBC driver, and is a third-party JAR that we want to use as a JDBC plugin for
the <code class="docutils literal notranslate"><span class="pre">cdap-data-pipeline</span></code> artifact. You would place the JAR file in the artifacts directory along with a
matching config file named <code class="docutils literal notranslate"><span class="pre">mysql-connector-java-5.1.3.json</span></code>. The config file would contain:</p>
<div class="highlight-json notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
  <span class="nt">&quot;parents&quot;</span><span class="p">:</span> <span class="p">[</span> <span class="s2">&quot;cdap-data-pipeline[3.2.0,4.0.0)&quot;</span> <span class="p">],</span>
  <span class="nt">&quot;plugins&quot;</span><span class="p">:</span> <span class="p">[</span>
    <span class="p">{</span>
      <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;mysql&quot;</span><span class="p">,</span>
      <span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;jdbc&quot;</span><span class="p">,</span>
      <span class="nt">&quot;description&quot;</span><span class="p">:</span> <span class="s2">&quot;MYSQL JDBC external plugin&quot;</span><span class="p">,</span>
      <span class="nt">&quot;className&quot;</span><span class="p">:</span> <span class="s2">&quot;com.mysql.jdbc.Driver&quot;</span>
    <span class="p">}</span>
  <span class="p">]</span>
<span class="p">}</span>
</pre></div>
</div>
<p>This config file specifies that the artifact can be used by versions 3.2.0 (inclusive) to 4.0.0 (exclusive)
of the cdap-data-pipeline artifact. It also specifies that there is one plugin of type <code class="docutils literal notranslate"><span class="pre">jdbc</span></code> and name
<code class="docutils literal notranslate"><span class="pre">mysql</span></code> with class <code class="docutils literal notranslate"><span class="pre">com.mysql.jdbc.Driver</span></code>. Once added, this system artifact would be usable by
applications in all namespaces.</p>
</div>
<div class="section" id="example-use-case-configurable-applications">
<h2>Example Use Case: Configurable Applications<a class="headerlink" href="#example-use-case-configurable-applications" title="Permalink to this headline">🔗</a></h2>
<p>We will now walk through an example use case in order to illustrate how artifacts are used.
In this example, we decide to implement an application class that reads from a stream and writes
to a table using a flow. The stream that it reads from—and the table that it writes to—will be configurable.
Our development team writes code such as:</p>
<div class="highlight-java notranslate"><div class="highlight"><pre><span></span><span class="kd">public</span> <span class="kd">class</span> <span class="nc">MyApp</span> <span class="kd">extends</span> <span class="n">AbstractApplication</span><span class="o">&lt;</span><span class="n">MyApp</span><span class="p">.</span><span class="na">MyConfig</span><span class="o">&gt;</span> <span class="p">{</span>

  <span class="kd">public</span> <span class="kd">static</span> <span class="kd">class</span> <span class="nc">MyConfig</span> <span class="kd">extends</span> <span class="n">Config</span> <span class="p">{</span>
    <span class="kd">private</span> <span class="n">String</span> <span class="n">stream</span><span class="p">;</span>
    <span class="kd">private</span> <span class="n">String</span> <span class="n">table</span><span class="p">;</span>

    <span class="kd">private</span> <span class="nf">MyConfig</span><span class="p">()</span> <span class="p">{</span>
      <span class="k">this</span><span class="p">.</span><span class="na">stream</span> <span class="o">=</span> <span class="s">&quot;A&quot;</span><span class="p">;</span>
      <span class="k">this</span><span class="p">.</span><span class="na">table</span> <span class="o">=</span> <span class="s">&quot;X&quot;</span><span class="p">;</span>
    <span class="p">}</span>
  <span class="p">}</span>

  <span class="kd">public</span> <span class="kt">void</span> <span class="nf">configure</span><span class="p">()</span> <span class="p">{</span>
    <span class="n">MyConfig</span> <span class="n">config</span> <span class="o">=</span> <span class="n">getContext</span><span class="p">().</span><span class="na">getConfig</span><span class="p">();</span>
    <span class="n">addStream</span><span class="p">(</span><span class="k">new</span> <span class="n">Stream</span><span class="p">(</span><span class="n">config</span><span class="p">.</span><span class="na">stream</span><span class="p">));</span>
    <span class="n">createDataset</span><span class="p">(</span><span class="n">config</span><span class="p">.</span><span class="na">table</span><span class="p">,</span> <span class="n">Table</span><span class="p">.</span><span class="na">class</span><span class="p">);</span>
    <span class="n">addFlow</span><span class="p">(</span><span class="k">new</span> <span class="n">MyFlow</span><span class="p">(</span><span class="n">config</span><span class="p">.</span><span class="na">stream</span><span class="p">,</span> <span class="n">config</span><span class="p">.</span><span class="na">table</span><span class="p">,</span> <span class="n">config</span><span class="p">.</span><span class="na">flowConfig</span><span class="p">));</span>
  <span class="p">}</span>
<span class="p">}</span>

<span class="kd">public</span> <span class="kd">class</span> <span class="nc">MyFlow</span> <span class="kd">implements</span> <span class="n">AbstractFlow</span> <span class="p">{</span>
  <span class="kd">private</span> <span class="n">String</span> <span class="n">stream</span><span class="p">;</span>
  <span class="kd">private</span> <span class="n">String</span> <span class="n">table</span><span class="p">;</span>

  <span class="n">MyFlow</span><span class="p">(</span><span class="n">String</span> <span class="n">stream</span><span class="p">,</span> <span class="n">String</span> <span class="n">table</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">this</span><span class="p">.</span><span class="na">stream</span> <span class="o">=</span> <span class="n">stream</span><span class="p">;</span>
    <span class="k">this</span><span class="p">.</span><span class="na">table</span> <span class="o">=</span> <span class="n">table</span><span class="p">;</span>
  <span class="p">}</span>

  <span class="nd">@Override</span>
  <span class="kd">public</span> <span class="kt">void</span> <span class="nf">configure</span><span class="p">()</span> <span class="p">{</span>
    <span class="n">setName</span><span class="p">(</span><span class="s">&quot;MyFlow&quot;</span><span class="p">);</span>
    <span class="n">setDescription</span><span class="p">(</span><span class="s">&quot;Reads from a stream and writes to a table&quot;</span><span class="p">);</span>
    <span class="n">addFlowlet</span><span class="p">(</span><span class="s">&quot;reader&quot;</span><span class="p">,</span> <span class="k">new</span> <span class="n">Reader</span><span class="p">(</span><span class="n">table</span><span class="p">));</span>
    <span class="n">connectStream</span><span class="p">(</span><span class="n">stream</span><span class="p">,</span> <span class="s">&quot;reader&quot;</span><span class="p">);</span>
  <span class="p">}</span>
<span class="p">}</span>

<span class="kd">public</span> <span class="kd">class</span> <span class="nc">Reader</span> <span class="kd">extends</span> <span class="n">AbstractFlowlet</span> <span class="p">{</span>
  <span class="nd">@Property</span>
  <span class="kd">private</span> <span class="n">String</span> <span class="n">tableName</span><span class="p">;</span>
  <span class="kd">private</span> <span class="n">Table</span> <span class="n">table</span><span class="p">;</span>

  <span class="n">Reader</span><span class="p">(</span><span class="n">String</span> <span class="n">tableName</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">this</span><span class="p">.</span><span class="na">tableName</span> <span class="o">=</span> <span class="n">tableName</span><span class="p">;</span>
  <span class="p">}</span>

  <span class="nd">@Override</span>
  <span class="kd">public</span> <span class="kt">void</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">FlowletContext</span> <span class="n">context</span><span class="p">)</span> <span class="kd">throws</span> <span class="n">Exception</span> <span class="p">{</span>
    <span class="n">table</span> <span class="o">=</span> <span class="n">context</span><span class="p">.</span><span class="na">getDataset</span><span class="p">(</span><span class="n">tableName</span><span class="p">);</span>
  <span class="p">}</span>

  <span class="nd">@ProcessInput</span>
  <span class="kd">public</span> <span class="kt">void</span> <span class="nf">process</span><span class="p">(</span><span class="n">StreamEvent</span> <span class="n">event</span><span class="p">)</span> <span class="p">{</span>
    <span class="n">Put</span> <span class="n">put</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Put</span><span class="p">(</span><span class="n">Bytes</span><span class="p">.</span><span class="na">toBytes</span><span class="p">(</span><span class="n">event</span><span class="p">.</span><span class="na">getHeaders</span><span class="p">().</span><span class="na">get</span><span class="p">(</span><span class="n">config</span><span class="p">.</span><span class="na">rowkey</span><span class="p">)));</span>
    <span class="n">put</span><span class="p">.</span><span class="na">add</span><span class="p">(</span><span class="s">&quot;timestamp&quot;</span><span class="p">,</span> <span class="n">event</span><span class="p">.</span><span class="na">getTimestamp</span><span class="p">());</span>
    <span class="n">put</span><span class="p">.</span><span class="na">add</span><span class="p">(</span><span class="s">&quot;body&quot;</span><span class="p">,</span> <span class="n">Bytes</span><span class="p">.</span><span class="na">toBytes</span><span class="p">(</span><span class="n">event</span><span class="p">.</span><span class="na">getBody</span><span class="p">()));</span>
    <span class="n">table</span><span class="p">.</span><span class="na">put</span><span class="p">(</span><span class="n">put</span><span class="p">);</span>
  <span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
<p>Our build system creates a JAR named <code class="docutils literal notranslate"><span class="pre">myapp-1.0.0.jar</span></code> that contains the <code class="docutils literal notranslate"><span class="pre">MyApp</span></code> class.
The JAR is deployed via the RESTful API:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">curl localhost:11015/v3/namespaces/default/artifacts/myapp --data-binary @myapp-1.0.0.jar</span>
</pre></div>
</div>
<p>CDAP determines the version is 1.0.0 by examining the manifest file contained in the JAR.
Information about the artifact and the application class in the artifact are now visible
through JAR API calls:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">curl localhost:11015/v3/namespaces/default/artifacts?scope=user</span>
<span class="go">[</span>
<span class="go">  { &quot;name&quot;: &quot;myapp&quot;, &quot;scope&quot;:&quot;USER&quot;,  &quot;version&quot;: &quot;1.0.0&quot; }</span>
<span class="go">]</span>

<span class="go">curl localhost:11015/v3/namespaces/default/artifacts/myapp/versions/1.0.0</span>
<span class="go">{</span>
<span class="go">  &quot;classes&quot;: {</span>
<span class="go">    &quot;apps&quot;: [</span>
<span class="go">      {</span>
<span class="go">        &quot;className&quot;: &quot;com.company.example.MyApp&quot;,</span>
<span class="go">        &quot;configSchema&quot;: {</span>
<span class="go">          &quot;fields&quot;: [</span>
<span class="go">            { &quot;name&quot;: &quot;stream&quot;, &quot;type&quot;: [ &quot;string&quot;, &quot;null&quot; ] },</span>
<span class="go">            { &quot;name&quot;: &quot;table&quot;, &quot;type&quot;: [ &quot;string&quot;, &quot;null&quot; ] }</span>
<span class="go">          ],</span>
<span class="go">          &quot;name&quot;: &quot;com.company.example.MyApp$MyConfig&quot;,</span>
<span class="go">          &quot;type&quot;: &quot;record&quot;</span>
<span class="go">        },</span>
<span class="go">        &quot;description&quot;: &quot;&quot;</span>
<span class="go">      }</span>
<span class="go">    ],</span>
<span class="go">    &quot;plugins&quot;: []</span>
<span class="go">  },</span>
<span class="go">  &quot;name&quot;: &quot;myapp&quot;,</span>
<span class="go">  &quot;scope&quot;: &quot;USER&quot;,</span>
<span class="go">  &quot;version&quot;: &quot;1.0.0&quot;</span>
<span class="go">}</span>
</pre></div>
</div>
<p>With this information, a separate deployment team is able to see that the artifact contains
an application class, and it contains a config that takes in a value for <code class="docutils literal notranslate"><span class="pre">stream</span></code> and <code class="docutils literal notranslate"><span class="pre">table</span></code>.
From this information, we decide to create an application named <code class="docutils literal notranslate"><span class="pre">purchaseDump</span></code> that reads
from the <code class="docutils literal notranslate"><span class="pre">purchases</span></code> stream and writes to the <code class="docutils literal notranslate"><span class="pre">events</span></code> table:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">curl -X PUT localhost:11015/v3/namespaces/default/apps/purchaseDump -H &#39;Content-Type: application/json&#39; -d &#39;</span>
<span class="go">{</span>
<span class="go">  &quot;artifact&quot;: {</span>
<span class="go">    &quot;name&quot;: &quot;myapp&quot;,</span>
<span class="go">    &quot;version&quot;: &quot;1.0.0&quot;,</span>
<span class="go">    &quot;scope&quot;: &quot;user&quot;</span>
<span class="go">  },</span>
<span class="go">  &quot;config&quot;: {</span>
<span class="go">    &quot;stream&quot;: &quot;purchases&quot;,</span>
<span class="go">    &quot;table&quot;: &quot;events&quot;</span>
<span class="go">  }</span>
<span class="go">}&#39;</span>
</pre></div>
</div>
<p>We can then manage the lifecycle of the flow using the
<span class="xref std std-ref">Application Lifecycle RESTful APIs</span>.
After it has been running for a while, a bug is found in the code. The development team provides
a fix, and <code class="docutils literal notranslate"><span class="pre">myapp-1.0.1.jar</span></code> is released. The artifact is deployed:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">curl localhost:11015/v3/namespaces/default/artifacts/myapp --data-binary @myapp-1.0.1.jar</span>
</pre></div>
</div>
<p>A call can be made to find all applications that use the old artifact:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">curl localhost:11015/v3/namespaces/default/apps?artifactName=myapp&amp;artifactVersion=1.0.0</span>
<span class="go">[</span>
<span class="go">  {</span>
<span class="go">    &quot;name&quot;: &quot;purchaseDump&quot;,</span>
<span class="go">    &quot;artifact&quot;: {</span>
<span class="go">      &quot;name&quot;: &quot;myapp&quot;,</span>
<span class="go">      &quot;version&quot;: &quot;1.0.0&quot;,</span>
<span class="go">      &quot;scope&quot;: &quot;user&quot;</span>
<span class="go">    },</span>
<span class="go">    ...</span>
<span class="go">  }</span>
<span class="go">]</span>
</pre></div>
</div>
<p>The flow for the <code class="docutils literal notranslate"><span class="pre">purchaseDump</span></code> application is stopped, then the application is updated:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">curl localhost:11015/v3/namespaces/default/apps/purchaseDump/update -d &#39;</span>
<span class="go">{</span>
<span class="go">  &quot;artifact&quot;: {</span>
<span class="go">    &quot;name&quot;: &quot;myapp&quot;,</span>
<span class="go">    &quot;version&quot;: &quot;1.0.1&quot;,</span>
<span class="go">    &quot;scope&quot;: &quot;user&quot;</span>
<span class="go">  },</span>
<span class="go">  &quot;config&quot;: {</span>
<span class="go">    &quot;stream&quot;: &quot;purchases&quot;,</span>
<span class="go">    &quot;table&quot;: &quot;events&quot;</span>
<span class="go">  }</span>
<span class="go">}&#39;</span>
</pre></div>
</div>
<p>The flow is started again, which picks up the new code. We quickly realize version 1.0.1 has a serious
bug and decide to roll back to the previous version. The flow is stopped and another update call is made:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">curl localhost:11015/v3/namespaces/default/apps/purchaseDump/update -d &#39;</span>
<span class="go">{</span>
<span class="go">  &quot;artifact&quot;: {</span>
<span class="go">    &quot;name&quot;: &quot;myapp&quot;,</span>
<span class="go">    &quot;version&quot;: &quot;1.0.0&quot;,</span>
<span class="go">    &quot;scope&quot;: &quot;user&quot;</span>
<span class="go">  },</span>
<span class="go">  &quot;config&quot;: {</span>
<span class="go">    &quot;stream&quot;: &quot;purchases&quot;,</span>
<span class="go">    &quot;table&quot;: &quot;events&quot;</span>
<span class="go">  }</span>
<span class="go">}&#39;</span>
</pre></div>
</div>
<p>Once the development team has resolved that serious bug, we can try re-deploying again…</p>
</div>
</div>

</div>
    <div class="col-md-2">
      <div id="right-sidebar" class="bs-sidenav scrollable-y" role="complementary">
        <div id="localtoc-scrollspy">
        </div>
      </div>
    </div></div>
</div>
<!-- block main content end -->
<!-- block footer -->
<footer class="footer">
      <div class="container">
        <div class="row">
          <div class="col-md-2 footer-left"><a title="Workflows" href="workflows.html" />Previous</a></div>
          <div class="col-md-8 footer-center"><a class="footer-tab-link" href="../table-of-contents/../../reference-manual/licenses/index.html">Copyright</a> &copy; 2014-2020 Cask Data, Inc.&bull; <a class="footer-tab-link" href="//docs.cask.co/cdap/6.1.1/cdap-docs-6.1.1-web.zip" rel="nofollow">Download</a> an archive or
<a class="footer-tab-link" href="//docs.cask.co/cdap">switch the version</a> of the documentation
          </div>
          <div class="col-md-2 footer-right"><a title="Program Lifecycle" href="program-lifecycle.html" />Next</a></div>
        </div>
      </div>
    </footer>
<!-- block footer end -->
<script type="text/javascript" src="../_static/bootstrap-3.3.6/js/bootstrap.min.js"></script><script type="text/javascript" src="../_static/js/bootstrap-sphinx.js"></script><script type="text/javascript" src="../_static/js/abixTreeList-2.js"></script><script type="text/javascript" src="../_static/js/cdap-dynamicscrollspy-4.js"></script><script type="text/javascript" src="../_static/js/cdap-version-menu.js"></script><script type="text/javascript" src="../_static/js/copy-to-clipboard.js"></script><script type="text/javascript" src="../_static/js/jquery.mousewheel.min.js"></script><script type="text/javascript" src="../_static/js/jquery.mCustomScrollbar.js"></script><script type="text/javascript" src="../_static/js/js.cookie.js"></script><script type="text/javascript" src="../_static/js/tabbed-parsed-literal-0.2.js"></script><script type="text/javascript" src="../_static/js/cdap-onload-javascript.js"></script><script type="text/javascript" src="../_static/js/cdap-version-menu.js"></script>
    <script src="https://cdap.gitee.io/docs/cdap/json-versions.js"/></script>
  </body>
</html>